﻿using System;
using System.Data;

namespace VitCode.Castle.Helper
{
    /// <summary>
    /// 輸出參數,輸入輸出參數和返回值參數的特殊數值物件
    /// 用於在使用<see cref="SqlHelper"></see>的時候，參數的輸入的時候使用
    /// </summary>
    public class NotInputParamterValue
    {
        private object m_Value;
        private ParameterDirection m_Direction = ParameterDirection.Output;
        private string m_Name;
        /// <summary>
        /// 
        /// </summary>
        public static NotInputParamterValue Instance
        {
            get { return new NotInputParamterValue(); }
        }

        /// <summary>
        /// 輸出輸入參數
        /// </summary>
        public virtual object Value
        {
            get { return m_Value; }
            set { m_Value = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public virtual ParameterDirection Direction
        {
            get { return m_Direction; }
            set
            {
                if (value == ParameterDirection.Input)
                    throw new ArgumentException("不能設定為Input參數");
                m_Direction = value;
            }
        }

        /// <summary>
        /// 參數名稱
        /// </summary>
        protected internal string Name
        {
            get { return m_Name; }
            set { m_Name = value; }
        }
    }
}
